<?php
    session_start();
    if($_SESSION['uid']==""||$_SESSION['level']!=2){
		exit();
	}
    include('/tool/submitValidate.php');
    include('/tool/pdo.php');
    include('/bll/PublicDataBLL.php');
    include('/class/public-data.class.php');
    include('/class/student-dormitory-exchanging.class.php');
    include('/bll/StudentDormitoryExchangingBLL.php');
    
    $action = isset($_POST['action']) ? $_POST['action'] : 0;
    $data = isset($_POST['data']) ? $_POST['data'] : null;

    switch((int)$action){
        //宿舍对换
        case 1:
            $exchangeStudent=json_decode($data);
            if(!$exchangeStudent==null){
                $StudentDormitoryExchangingBLL=new StudentDormitoryExchangingBLL();
                $result=$StudentDormitoryExchangingBLL->exchangeStudentDormitory($exchangeStudent);
            }
        break;
        case 2:break;
        default:break;
    }

    echo json_encode($result,JSON_UNESCAPED_UNICODE);
?>